home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-11
/
colorset.zip
/
COLORSET.DOC
< prev
next >
Wrap
Text File
|
1993-01-04
|
6KB
|
176 lines
COLORSET
A CLIPPER COLOR SELECTION ROUTINE
by
MICHAEL K. BOZOVICH
###############################################################################
I wrote this because I needed it. Other people may also find it useful.
If so, that is great. Anybody is welcome to use or not use anything included
in this ZIP file to his/her heart's content. If you do NOT like it, erase it;
don't gripe at me...
The files in this ZIP should consist of:
INKEY.H &&\
ACHOICE.H && PreProcessor Header Files
COLORSET.H &&/
COLORSET. && Microsoft MAKE response file
COLORSET.PRE && The Pre-PreProcessed Source (Nicely Formatted)
COLORSET.PRG && The PreProcessed Source (Could be ugly...)
COLORSET.EXE && The DEMO Executable
COLORSET.DOC && Take a wild guess...
You MUST have a copy of the IDL function library to link this code. If
you are unfortunate enough to NOT have a copy, one may be obtained from:
Integrated Development Corporation
(603)382-1313
The program creates two memory files if they are not found in the current
directory at run time. They are:
COLORS.MEM && Contains the color string variables.
ATTRIB.MEM && Contains the screen memvar for the
&& 'attribute rectangle'.
The source is generously commented (by my standards, anyway), and should
be pretty much self-documenting. It demonstrates the power of the IDL
attribute functions nicely. It also demonstrates some uses for a preprocessor.
###############################################################################
There are 4 major procedures where all the action takes place.
COLORSET:
Sets up initial variables and environment, draws the main part of the
screen, and calls ACHOICE(). The routine that draws the rectangle
of all possible colors is mildly interesting. If you can improve upon
it's EXECUTION SPEED, please let me know. That's pretty much it.
SHOWSTAT():
This is the function called repeatedly by ACHOICE(). It is responsible
for the 'real-time' color updating in the sample window. It is also
where the COLORSEL routine is called when the user presses <Enter>.
After COLORSEL is called, the appropriate color string(s) is/are updated.
Interesting points here include the method of keeping the menu hilite
turned on while in this function and the kludge used to allow the hilite
to wrap like 'MENU TO'.
COLORSEL:
This procedure does some string/numeric conversions and sets up a 'dummy'
wait state so we can call a hot key procedure assigned to all four arrow
keys. Some hand stands are performed to keep the GET from showing up
on the screen, what with the colors changing all the time and all, but
it works.
NAVIGATE:
This is the hot key procedure called from the dummy wait state.
It moves the arrow pointers around while updating the sample window and
updating the numeric attribute variables.
###############################################################################
The colors I keep track of in most large systems I write and their respective
variables are outlined below:
Normal Text - c_scr_color
This is the normal foreground and background colors used by 99% of the
code. Both 'Standard' and 'Enhanced' portions of the string are tracked.
The 'Standard' portion of this string is forced to be the 'Enhanced'
portion of the 'Inverse Video' string (and vice versa). See the source
for details of this restriction.
High Intensity - c_int_color
I use this for screen titles and other important messages that I do not
want to go unnoticed. The background portion of the string is forced to
be the same as that of 'Normal Text'. Only the 'Standard' portion is used.
Inverse Video - c_inv_color
I use this for pop-up pick lists and windows. It is nice to have a true
inverse of the normal text string. This string depends on the Normal
Text variable (and vice versa). (See 'Normal Text')
Status Messages - c_msg_color
This color is used for harmless status messages like 'Indexing',
'Printing', 'Loading', etc.... Only the 'Standard' portion is used.
Error Messages - c_err_color
Just what you would imagine...
Help Screens - c_hlp_color
Also self-explanatory.
These color string variables use the Clipper NUMERIC convention for colors
instead of the string convention because it is MUCH easier to code; esp.
since the IDL functions expect an <expN> as argument(s). It is a hell of a
lot easier to convert "7/0" to 7 than it is to convert "g/rb" (Yecch!) to 82.
The restrictions (if any) placed on each variable are enforced by the code.
Note that the code totally disallows the combinations where text would be
invisible...
###############################################################################
A possible modification to this code would be to make the menu a "MENU
TO" vs. the current ACHOICE(). This would keep you from 'real-time'
updating the sample window while the bounce bar moves, but would simplify the
code and reduce memory requirements.
Other (needed) modifications:
-- A coherent method of adding a 'blink' to appropriate variables.
-- Stripping out the STRZERO() from EXAMPLEP in EXTEND. (I did this
with MY extend, but in the interest of compatibility, I left it
in here.)
Contact me at:
The Alton Penguin
300/1200/2400 N81
Evenings after 1800 CST/Weekends
(618)463-0427